/**
 * Created by NelliSwathi on 2/14/2015.
 */
$(document).ready (function() {
    $('#submitID').click(function () {
        var postEndPointOptions = {
            url: "http://localhost:9300/createUserDetails",
            type: "POST",
            dataType: "json",

            timeout: 10000,//10 secs
            // request browser to server
            //15secs

            success: function (data, status, requestObj) {

                alert('created user successfully');

            },
            error: function (error) {

                alert('error occurred while saving data');
            },
            complete: function () {

            }
        };
    });
    $('#btnNavigateUserDetails').click(function (event) {

        $('#userDetails').load('form.html', function () {


            $('#btnSubmit').click(function () {

                var userDetails = getUserEnteredValues();

            })
        })
    });



        function getUserEnteredValues() {
            var userDetails = {};

            userDetails.name = $('#nameInput').val();
            userDetails.address = $('#addressInput').val();
            userDetails.email = $('#emailInput').val();
            userDetails.phone = $('#phoneInput').val();
            postEndPointOptions.data = userDetails;
            $.ajax(postEndPointOptions);
            return userDetails;
        }


});
